# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=acpi_call-src
_modname=acpi_call
pkgver=1.2.1
pkgrel=0
pkgdesc="A kernel module for calling ACPI methods via /proc/acpi/call (sources, AKMS)"
url="https://github.com/nix-community/acpi_call"
arch="noarch"
license="GPL-3.0-or-later"
source="https://github.com/nix-community/acpi_call/archive/v$pkgver/acpi_call-src-$pkgver.tar.gz
	$pkgname-fix-for-5.13+-kernels.patch::https://github.com/nix-community/acpi_call/commit/48011f82726c263f49a2b9ca3d9f674bdb4cfd22.patch
	"
builddir="$srcdir/$_modname-$pkgver"

prepare() {
	default_prepare

	cat >AKMBUILD <<-EOF
	modname=$_modname
	modver=$pkgver-r$pkgrel
	built_modules='$_modname.ko'
	EOF

	echo acpi_call > "$_modname.conf"
}

package() {
	install -D -m644 -t "$pkgdir"/usr/src/$_modname-$pkgver *.c Makefile AKMBUILD
	install -D -m644 -t "$pkgdir"/usr/lib/modules-load.d/ "$_modname.conf"
}

sha512sums="
91553cf70a6b0173a6bfec38fcfb62ecd17614c91a888933704bb57d788592ce6981b01fb7c5e4bb8efdbe7fe229860c9f2be4b549dd71b232704c8bf0b3cfee  acpi_call-src-1.2.1.tar.gz
587ba8155311bacbf8a150c36857858b6399feac87aeee5f5f5075c4954b730d909fc7c8d8c2c094cc801bff669ccac9d24f362eeb103d96c53deba543e5e388  acpi_call-src-fix-for-5.13+-kernels.patch
"
